#include "IndexDB.h"
#include <assert.h>

#ifdef NDEBUG
#error Cannot test in NDEBUG mode! Please run "./boostrap --enable-debug"
#endif

int main()
{
	FileSystem_Init();

	unlink("./test-index.db");
	IndexDB myTest("./test-index.db");

	SizeType iFile1 = myTest.CreateFile(1, 2);
	assert(0 == iFile1);
	SizeType iFile2 = myTest.CreateFile(3, 4);
	assert(1 == iFile2);

	assert(1 == myTest.GetFirstRecord(0));
	assert(2 == myTest.GetLastRecord(0));
	assert(3 == myTest.GetFirstRecord(1));
	assert(4 == myTest.GetLastRecord(1));

	sFileRecord myRecord;
	assert(myTest.GetFileRecord(0, myRecord));
	assert(1 == myRecord.iFirstRecordID);
	assert(2 == myRecord.iLastRecordID);
	assert(myTest.GetFileRecord(1, myRecord));
	assert(3 == myRecord.iFirstRecordID);
	assert(4 == myRecord.iLastRecordID);

	return 0;
};

